#import "NSArray+HOM.h"
#import "MYTrampoline.h"


@implementation NSArray(HOM)

/**
 * 重写了MYTrampoline的该方法
 * 修改成更容易理解的
 */
- (NSMethodSignature *)findMethodSignatureForSelector:(SEL)aSelector
{
	for (id object in self) {
		if ([object respondsToSelector:aSelector]) {
			return [object methodSignatureForSelector:aSelector];
		}
	}
	return [self methodSignatureForSelector:aSelector];
}



- (id)makeObjectsPerform
{
	return [MYTrampoline trampolineForTarget:self andSelector:@selector(makeObjectsPerformInvocation:)];
}

- (void)makeObjectsPerformInvocation:(NSInvocation *)invocation
{
	id object = nil;
	for (object in self) {//让每个对象都调用
		[invocation invokeWithTarget:object];
	}
}

@end
